﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSharpAlgorithm
{
    class FibonacciFunc
    {
        public FibonacciFunc()
        {
            int testCase = Int32.Parse(TestConsole.ReadLine());
            int[,] dp = new int[41,2];
            dp[0, 0] = 1;
            dp[1, 1] = 1;
            for (int i = 2; i <= 40; i++)
            {
                dp[i, 0] = dp[i - 1, 0] + dp[i - 2, 0];
                dp[i, 1] = dp[i - 1, 1] + dp[i - 2, 1];
            }
            while (testCase-- > 0)
            {
                int n = Int32.Parse(TestConsole.ReadLine());
                Console.WriteLine(dp[n, 0] + " " + dp[n, 1]);
            }
        }
    }
}
